/*
Replication File for "Middle Eastern and North African Americans may not be perceived, nor perceive themselves to be White"
Forthcoming at PNAS
Authors: Neda Maghbouleh, Ariela Schachter, and René D. Flores

Note: this do-file was created in STATA v. 16 and uses the following ado files:coefplot, outreg2, asdoc, combomarginsplot, desctable and grc1leg.

You must install each of these ado files in order to run this do file.

Please send any questions about data/code to: Ariela Schachter ariela@wustl.edu 
*/
clear


use Maghbouleh_Schachter_Flores_2022_Public.dta,replace

**Step 1: Recode select variables for analysis**

gen white =0
replace white=1 if race==1

gen black=0
replace black=1 if race==2

gen other=0
replace other=1 if race==3|race==4|race==5

gen mena=0
replace mena=1 if race==6

gen t_gat_comb1=.
replace t_gat_comb1=1 if t_gat==1
replace t_gat_comb1=2 if t_gat==2
replace t_gat_comb1=3 if t_gat==3
replace t_gat_comb1=4 if t_gat==4
replace t_gat_comb1=5 if t_gat==5
replace t_gat_comb1=6 if t_gat==6|t_gat==7|t_gat==8|t_gat==9
replace t_gat_comb1=7 if t_gat==10|t_gat==11|t_gat==12|t_gat==13
replace t_gat_comb1=8 if t_gat==14|t_gat==15|t_gat==16|t_gat==17
replace t_gat_comb1=9 if t_gat==18|t_gat==19|t_gat==20|t_gat==21
replace t_gat_comb1=10 if t_gat==22|t_gat==23|t_gat==24|t_gat==25
replace t_gat_comb1=11 if t_gat==26|t_gat==27|t_gat==28|t_gat==29
replace t_gat_comb1=12 if t_gat==30|t_gat==31|t_gat==32|t_gat==33

lab def t_gat_comb1_lbl 1"European" 2"Sub-Saharan" 3"Arab" 4"North African" 5"Iran/Iraq" 6"European-Sub-Saharan" 7"European-Arab" 8"European-North African" 9"European Iran/Iraq" 10"Sub-Saharan-Arab" 11"Sub-Saharan-North African" 12"Sub-Saharan-Iran/Iraq"

lab val t_gat_comb1 t_gat_comb1_lbl

gen occ_short=.
replace occ_short=1 if t_occ==1|t_occ==2|t_occ==3
replace occ_short=2 if t_occ==4|t_occ==5|t_occ==6
replace occ_short=3 if t_occ==7|t_occ==8|t_occ==9
lab def occ_short_lbl 1"Low status" 2"Medium status" 3"High status"
lab val occ_short occ_short_lbl

gen skin_cat=.
replace skin_cat=1 if t_skin<=3
replace skin_cat=2 if t_skin>3&t_skin<7
replace skin_cat=3 if t_skin>=7&t_skin<.
lab def t_skin_cat_lbl 1"Light" 2"Medium" 3"Dark"
lab val skin_cat t_skin_cat_lbl

gen name_short=.
replace name_short=1 if t_name==1|t_name==2
replace name_short=2 if t_name==3|t_name==4
replace name_short=3 if t_name==5|t_name==6
replace name_short=4 if t_name==7|t_name==8
replace name_short=5 if t_name==9|t_name==10

lab def name_short_lbl 1"Claire/Jake" 2"DeShawn/Lakisha" 3"Mohammed/Nawal" 4"Ziad/Randa" 5"Alireza/Samira"
lab val name_short name_short_lbl

gen MENA = mena
gen White = white
gen Black = black

gen nct_white=0
replace nct_white=1 if nct_resp_detail==1
replace nct_white=. if nct_resp_detail==.


lab def nct_treat_lbl 0 "Control" 1 "Treatment"
lab val nct_treat nct_treat_lbl

encode(bornus), gen(usborn)
encode(parborn), gen(parentsborn)

gen generation=.
replace generation=1 if usborn==1
replace generation=2 if usborn==2&parentsborn==1
replace generation=3 if usborn==2&parentsborn>1&parentsborn<.
lab def gen_lbl 1"First" 2"Second" 3"Third+"
lab val generation gen_lbl

gen mena_disc=.
replace mena_disc=1 if discrim_mena=="None"
replace mena_disc=2 if discrim_mena=="A little"
replace mena_disc=3 if discrim_mena=="Some"
replace mena_disc=4 if discrim_mena=="A lot"

mean mena_disc
mean mena_disc, over(sample)

gen alotmenadisc=0
replace alotmenadisc=1 if mena_disc==4
replace alotmenadisc=. if mena_disc==.

gen relig_cat=.
replace relig_cat=1 if relig=="Muslim"
replace relig_cat=2 if relig=="Greek or Russian Orthodox"
replace relig_cat=2 if relig=="Mormon"
replace relig_cat=2 if relig=="Protestant"
replace relig_cat=2 if relig=="Roman Catholic"
replace relig_cat=3 if relig=="Buddhist"
replace relig_cat=3 if relig=="Hindu"
replace relig_cat=3 if relig=="Jewish"
replace relig_cat=4 if relig=="agnostic"
replace relig_cat=4 if relig=="atheist"
replace relig_cat=2 if four_faith=="christian"
replace relig_cat=2 if four_faith=="christian "
replace relig_cat=3 if four_faith=="other"
replace relig_cat=4 if four_faith=="non"
lab def relig_cat_lbl 1"Muslim" 2"Christian" 3"Other" 4"No religion"
lab val relig_cat relig_cat_lbl
replace relig_cat=. if sample==3


destring(fullmena), replace
replace fullmena=. if sample==3

drop source
rename sample source 

gen muslim_disc=.
replace muslim_disc=1 if discrim_muslim=="None"
replace muslim_disc=2 if discrim_muslim=="A little"
replace muslim_disc=3 if discrim_muslim=="Some"
replace muslim_disc=4 if discrim_muslim=="A lot"

tab mena_disc muslim_disc, col chi2

gen alotmuslimdisc=0
replace alotmuslimdisc=1 if muslim_disc==4
replace alotmuslimdisc=. if muslim_disc==.

 gen discrim_cross=.
 replace discrim_cross=1 if alotmenadisc==0&alotmuslimdisc==0
 replace discrim_cross=2 if alotmenadisc==0&alotmuslimdisc==1
  replace discrim_cross=3 if alotmenadisc==1&alotmuslimdisc==0
   replace discrim_cross=4 if alotmenadisc==1&alotmuslimdisc==1
lab def cross_lbl 1"Low MENA, Low Muslim" 2"Low MENA, High Muslim" 3"High MENA, Low Muslim" 4"High MENA, High Muslim"
lab val discrim_cross cross_lbl

gen female=0
replace female=1 if gender=="Female"
replace female=. if gender==""

gen partyid=.
replace partyid=1 if pid3=="Democrat"
replace partyid=2 if pid3=="Republican"
replace partyid=3 if pid3=="Other"
replace partyid=3 if pid3=="Independent"
replace partyid=1 if pid_closer=="Democratic Party"
replace partyid=2 if pid_closer=="Republican Party"
lab def partyid_lbl 1"Democrat" 2"Republican" 3"Other"
lab val partyid partyid_lbl

encode(citizen), gen(uscit)
encode(educ), gen(education)
encode(hhinc), gen(inc)

gen hhincome=.
replace hhincome=1 if inc==10|inc==3
replace hhincome=2 if inc==4|inc==5|inc==6
replace hhincome=3 if inc==7|inc==8|inc==9
replace hhincome=4 if inc==1|inc==2
lab def inc_lbl 1"Less than 29,999" 2"30,000-59,999" 3"60,000-99,999" 4"100,000 or more"
lab val hhincome inc_lbl


replace relig_cat=1 if relig=="Muslim"&source==3
replace relig_cat=2 if relig=="Greek or Russian Orthodox"&source==3
replace relig_cat=2 if relig=="Mormon"&source==3
replace relig_cat=2 if relig=="Protestant"&source==3&source==3
replace relig_cat=2 if relig=="Roman Catholic"&source==3
replace relig_cat=3 if relig=="Buddhist"&source==3
replace relig_cat=3 if relig=="Hindu"&source==3
replace relig_cat=3 if relig=="Jewish"&source==3
replace relig_cat=4 if relig=="agnostic"&source==3
replace relig_cat=4 if relig=="atheist"&source==3
replace relig_cat=3 if relig=="something else:"&source==3

********************************************************

**Step 2: Generate Figures 2-4 for Main Manuscript

foreach var of varlist MENA White Black {
quietly reg `var' ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat ib1.t_gat_comb1 if source==1, cluster(respid)
estimates store mena_p_`var'
quietly reg `var' ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat ib1.t_gat_comb1 if source==3, cluster(respid)
estimates store white_`var'
coefplot (mena_p_`var', label(MENA)) (white_`var', label (non-Hispanic White)) , drop(_cons) baselevels xline(0) grid(none) ///
headings(1.name_short= "{it:Name}" 1.t_relig="{it:Religion}" 1.t_lang="{it:Language}" ///
1.occ_short="{it:Occupation}" 1.skin_cat="{it:Skin Color}" ///
1.t_gat_comb1="{it:Ancestry}" , labsize(tiny) labcolor(purple)) ///
ylabel(,labsize(tiny)) msize(small) scheme(cleanplots)  ///
xtitle("Effect on Pr(`var')") xlabel(-.5(.1).7) legend(position(6)) ///
title("") ytitle("")
graph export `var'.eps, replace
}

**Step 3: Generate Figure 5 for Main Manuscript
hist nct_resp_detail if profile==1&source==1, by(nct_treat, note("") legend(off)) discrete percent scheme(cleanplots) addlabels addlabopts(mlabsize(vsmall))  ///
ylabel(0(10)100) xlabel(1(1)15, valuelabel labsize(vsmall) angle(45)) xtitle("") gap(60)
graph export prolific_nct_detail.eps, replace
**************************************************************
**Supplementary Tables and Figures


**Table S1. Descriptives by Sample

desctable age female i.education i.hhincome i.partyid i.generation i.relig_cat mideas northaf alotmenadisc alotmuslimdisc  if profile==1, filename("descriptives_rr") group(source) stat(mean sd n)

***Table S2. Predicting MENA classification
set more off
quietly reg mena ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat ib1.t_gat_comb1 if source==1 , cluster(respid)
outreg2 using table1.doc, stats (coef) ctitle(coef) symbol(***,**,*,+) alpha(0.001, 0.01, 0.05, 0.10) dec(2) label replace word
outreg2 using table1.doc, stats (se) ctitle(se) dec(2) label append word
quietly reg mena ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat ib1.t_gat_comb1 if source==2, cluster(respid)
outreg2 using table1.doc, stats (coef) ctitle(coef) symbol(***,**,*,+) alpha(0.001, 0.01, 0.05, 0.10) dec(2) label append word
outreg2 using table1.doc, stats (se) ctitle(se) dec(2) label append word
quietly reg mena ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat ib1.t_gat_comb1 if source==3, cluster(respid)
outreg2 using table1.doc, stats (coef) ctitle(coef) symbol(***,**,*,+) alpha(0.001, 0.01, 0.05, 0.10) dec(2) label append word
outreg2 using table1.doc, stats (se) ctitle(se) dec(2) label append word

***Table S3: Predicting not MENA (White or Black)
quietly reg white ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat ib1.t_gat_comb1 if source==1,cluster(respid)
outreg2 using table2.doc, stats (coef) ctitle(coef) symbol(***,**,*,+) alpha(0.001, 0.01, 0.05, 0.10) dec(2) label replace word
outreg2 using table2.doc, stats (se) ctitle(se) dec(2) label append word
quietly reg white ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat ib1.t_gat_comb1 if source==2, cluster(respid)
outreg2 using table2.doc, stats (coef) ctitle(coef) symbol(***,**,*,+) alpha(0.001, 0.01, 0.05, 0.10) dec(2) label append word
outreg2 using table2.doc, stats (se) ctitle(se) dec(2) label append word
quietly reg white ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat ib1.t_gat_comb1 if source==3, cluster(respid)
outreg2 using table2.doc, stats (coef) ctitle(coef) symbol(***,**,*,+) alpha(0.001, 0.01, 0.05, 0.10) dec(2) label append word
outreg2 using table2.doc, stats (se) ctitle(se) dec(2) label append word

quietly reg black ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat ib1.t_gat_comb1 if source==1,cluster(respid)
outreg2 using table2.doc, stats (coef) ctitle(coef) symbol(***,**,*,+) alpha(0.001, 0.01, 0.05, 0.10) dec(2) label append word
outreg2 using table2.doc, stats (se) ctitle(se) dec(2) label append word
quietly reg black ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat ib1.t_gat_comb1 if source==2, cluster(respid)
outreg2 using table2.doc, stats (coef) ctitle(coef) symbol(***,**,*,+) alpha(0.001, 0.01, 0.05, 0.10) dec(2) label append word
outreg2 using table2.doc, stats (se) ctitle(se) dec(2) label append word
quietly reg black ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat ib1.t_gat_comb1 if source==3, cluster(respid)
outreg2 using table2.doc, stats (coef) ctitle(coef) symbol(***,**,*,+) alpha(0.001, 0.01, 0.05, 0.10) dec(2) label append word
outreg2 using table2.doc, stats (se) ctitle(se) dec(2) label append word

***figures S1 - S3
foreach var of varlist MENA White Black {
quietly reg `var' ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat ib1.t_gat_comb1 if source==1, cluster(respid)
estimates store p_`var'
quietly reg `var' ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat ib1.t_gat_comb1 if source==2, cluster(respid)
estimates store l_`var'	
coefplot (p_`var', label(Prolific)) (l_`var', label(Lucid)) , drop(_cons) baselevels xline(0) grid(none) ///
headings(1.name_short= "{it:Name}" 1.t_relig="{it:Religion}" 1.t_lang="{it:Language}" ///
1.occ_short="{it:Occupation}" 1.skin_cat="{it:Skin Color}" ///
1.t_gat_comb1="{it:Ancestry}" , labsize(tiny) labcolor(purple)) ///
ylabel(,labsize(tiny)) msize(small) scheme(cleanplots)  ///
xtitle("Effect on Pr(`var')") xlabel(-.5(.1).7) legend(position(6)) ///
title("") ytitle("")
graph export mena_`var'.pdf, replace
graph export mena_`var'.png, replace
}

**figure S4
set more off
foreach var of varlist  MENA White Black {
quietly reg `var' ib1.t_name ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat ib1.t_gat_comb1 if source==1, cluster(respid)
margins t_name
marginsplot, recast(scatter) scheme(lean2) ///
xlabel(, angle(45)) ytitle("") xtitle("") title("`var'") ///
xline(2.5) xline(4.5) xline(6.5) xline(8.5) xline(10.5)
graph save `var'.gph, replace
}

graph combine MENA.gph White.gph Black.gph, ycommon altshrink scheme(lean2)
graph export name_gender_prolific.pdf, as(pdf) replace

**figure S5
set more off
foreach var of varlist  MENA White Black {
quietly reg `var' ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.t_skin ib1.t_gat_comb1 if source==1, cluster(respid)
margins t_skin
marginsplot, recast(scatter) scheme(lean2) ///
xlabel(, angle(45)) ytitle("") xtitle("") title("`var'") ///
xline(3.5) xline(6.5)
graph save `var'.gph, replace
}

graph combine MENA.gph White.gph Black.gph, ycommon altshrink scheme(lean2)
graph export skin_long_prolific.pdf, as(pdf) replace

**figure S6
set more off
foreach var of varlist  MENA White Black {
quietly reg `var' ib1.name_short ib1.t_relig ib1.t_lang ib1.t_occ ib1.skin_cat ib1.t_gat_comb1 if source==1, cluster(respid)
margins t_occ
marginsplot, recast(scatter) scheme(lean2) ///
xlabel(1(1)9, labsize(tiny) angle(45)) ytitle("") xtitle("") title("`var'") ///
xline(3.5) xline(6.5) 
graph save `var'.gph, replace
}

graph combine MENA.gph White.gph Black.gph, ycommon  scheme(lean2)
graph export occ_long_prolific.pdf, as(pdf) replace


**figure S7
set more off
foreach var of varlist  MENA White Black {
quietly reg `var' ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_shor ib1.skin_cat ib1.t_gat if source==1, cluster(respid)
margins t_gat
marginsplot, recast(scatter) scheme(lean2) ///
xlabel(1(1)33, labsize(tiny) angle(45)) ytitle("") xtitle("") title("`var'") ///
xline(5.5) xline(9.5) xline(13.5) xline(17.5) xline(21.5) xline(25.5) xline(29.5)
graph save `var'.gph, replace
}

graph combine MENA.gph White.gph Black.gph, ycommon  scheme(lean2)
graph export gat_long_prolific.pdf, as(pdf) replace

**Figure S8
reg mena ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat ib1.t_gat_comb1##i.source if source!=2, cluster(respid)
margins t_gat_comb1, over(source)
marginsplot, recast(scatter) scheme(cleanplots) xlabel(1(1)12, labsize(tiny) angle(45)) ///
ytitle("PR(Classified Profile as MENA)") xtitle("Ancestry Treatment") title("")
graph export ancestry_bysample.pdf, as(pdf) replace

***Figure S9
reg mena ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat##i.source ib1.t_gat_comb1 if source!=2, cluster(respid)
margins skin_cat, over(source)
marginsplot, recast(scatter) scheme(cleanplots) xlabel(1(1)3, labsize(small)) ///
ytitle("PR(Classified Profile as MENA)") xtitle("Skin Color Treatment") title("")
graph export skincolor_bysample.pdf, as(pdf) replace

**Figure S10
reg white ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat##i.source ib1.t_gat_comb1 if source!=2, cluster(respid)
margins skin_cat, over(source)
marginsplot, recast(scatter) scheme(cleanplots) xlabel(1(1)3, labsize(small)) ///
ytitle("PR(Classified Profile as White)") xtitle("Skin Color Treatment") title("")
graph save whiteskin_samp.gph, replace

reg black ib1.name_short ib1.t_relig ib1.t_lang ib1.occ_short ib1.skin_cat##i.source ib1.t_gat_comb1 if source!=2, cluster(respid)
margins skin_cat, over(source)
marginsplot, recast(scatter) scheme(cleanplots) xlabel(1(1)3, labsize(small)) ///
ytitle("PR(Classified Profile as Black)") xtitle("Skin Color Treatment") title("")
graph save blackskin_samp.gph, replace
grc1leg whiteskin_samp.gph blackskin_samp.gph, ycommon scheme(cleanplots)
graph export whiteblackskin_samp.pdf, as(pdf) replace

**Table S4
asdoc tab nct_resp_detail nct_treat if profile==1&source==1,  col chi2 save(nct_combine_107.doc) replace

**Table S5
asdoc tab nct_resp_detail nct_treat if profile==1&source==2,  col chi2 save(nct_combine_107.doc) append

**Table S6
asdoc tab nct_resp_detail nct_treat if profile==1&mideast==1,  col chi2 save(nct_combine_107.doc) append

asdoc tab nct_resp_detail nct_treat if profile==1&northaf==1,  col chi2 save(nct_combine_107.doc) append

**Table S7
bysort generation: asdoc tab nct_resp_detail nct_treat if profile==1&source<3, col chi2

**Table S8
asdoc tab nct_resp_detail nct_treat if profile==1&alotmenadisc==0,  col chi2 save(nct_combine_107.doc) append

asdoc tab nct_resp_detail nct_treat if profile==1&alotmenadisc==1,  col chi2 save(nct_combine_107.doc) append

**Table S9
reg nct_treat age female ib2.education i.hhincome i.partyid i.generation ib2.relig_cat mideas northaf alotmenadisc if source==1&profile==1
outreg2 using randomcheck.doc, stats (coef) ctitle(coef) symbol(***,**,*,+) alpha(0.001, 0.01, 0.05, 0.10) dec(2) label replace word
outreg2 using randomcheck.doc, stats (se) ctitle(se) dec(2) label append word
reg nct_treat age female ib2.education i.hhincome i.partyid i.generation ib2.relig_cat mideas northaf alotmenadisc if source==2&profile==1
outreg2 using randomcheck.doc, stats (coef) ctitle(coef) symbol(***,**,*,+) alpha(0.001, 0.01, 0.05, 0.10) dec(2) label append word
outreg2 using randomcheck.doc, stats (se) ctitle(se) dec(2) label append word

**Table S10 ***why aren't ##s the same??**
bysort relig_cat: asdoc tab nct_resp_detail nct_treat if profile==1&source<3, col chi2 save(nct_rr.doc) replace

**Figure S11
reg nct_white i.nct_treat##i.source if profile==1&source<3
margins nct_treat, over(source)
marginsplot, recast(scatter) ytitle("Pr(ID as White only)") scheme(cleanplots) ///
 xtitle("") title("") ylabel(0(.1)1)
 graph export notwhiteonly_bysamp.pdf, as(pdf) replace
 
**Figure S12
hist nct_resp_detail if profile==1&source==2, by(nct_treat, note("") legend(off)) discrete percent scheme(cleanplots) addlabels addlabopts(mlabsize(vsmall))  ///
ylabel(0(10)100) xlabel(1(1)15, valuelabel labsize(vsmall) angle(45)) xtitle("") gap(60)
graph export lucid_nct_detail.pdf, as(pdf) replace

**Figure S13
hist nct_resp_detail if profile==1&mideast==1, by(nct_treat, note("") legend(off)) discrete percent scheme(cleanplots) addlabels addlabopts(mlabsize(vsmall))  ///
ylabel(0(10)100) xlabel(1(1)15, valuelabel labsize(vsmall) angle(45)) xtitle("") gap(60)
graph export mideast_combined_nct_detail.pdf, as(pdf) replace

**Figure S14
hist nct_resp_detail if profile==1&northaf==1, by(nct_treat, note("") legend(off)) discrete percent scheme(cleanplots) addlabels addlabopts(mlabsize(vsmall))  ///
ylabel(0(10)100) xlabel(1(1)15, valuelabel labsize(vsmall) angle(45)) xtitle("") gap(60)
graph export northaf_combined_nct_detail.pdf, as(pdf) replace

**Figure S15
hist nct_resp_detail if profile==1&generation==1, by(nct_treat, note("") legend(off)) discrete percent scheme(cleanplots) addlabels addlabopts(mlabsize(vsmall))  ///
ylabel(0(10)100) xlabel(1(1)15, valuelabel labsize(vsmall) angle(45)) xtitle("") gap(60)
graph export firstgen_combined_nct_detail.pdf, as(pdf) replace

**Figure S16
hist nct_resp_detail if profile==1&generation==2, by(nct_treat, note("") legend(off)) discrete percent scheme(cleanplots) addlabels addlabopts(mlabsize(vsmall))  ///
ylabel(0(10)100) xlabel(1(1)15, valuelabel labsize(vsmall) angle(45)) xtitle("") gap(60)
graph export secondgen_combined_nct_detail.pdf, as(pdf) replace

**Figure S17
hist nct_resp_detail if profile==1&generation==3, by(nct_treat, note("") legend(off)) discrete percent scheme(cleanplots) addlabels addlabopts(mlabsize(vsmall))  ///
ylabel(0(10)100) xlabel(1(1)15, valuelabel labsize(vsmall) angle(45)) xtitle("") gap(60)
graph export thirdgen_combined_nct_detail.pdf, as(pdf) replace

**Figure S18
hist nct_resp_detail if profile==1&alotmenadisc==0, by(nct_treat, note("") legend(off)) discrete percent scheme(cleanplots) addlabels addlabopts(mlabsize(vsmall))  ///
ylabel(0(10)100) xlabel(1(1)15, valuelabel labsize(vsmall) angle(45)) xtitle("") gap(60)
graph export nodisc_combined_nct_detail.pdf, as(pdf) replace

**Figure S19
hist nct_resp_detail if profile==1&alotmenadisc==1, by(nct_treat, note("") legend(off)) discrete percent scheme(cleanplots) addlabels addlabopts(mlabsize(vsmall))  ///
ylabel(0(10)100) xlabel(1(1)15, valuelabel labsize(vsmall) angle(45)) xtitle("") gap(60)
graph export highdisc_combined_nct_detail.pdf, as(pdf) replace

**Figure S20
reg nct_white i.nct_treat if profile==1&source<3&mideast==1 
margins nct_treat, saving(mideast, replace)
reg nct_white i.nct_treat if profile==1&source<3&northaf==1 
margins nct_treat, saving(northaf, replace)
combomarginsplot mideast northaf, labels("Middle Eastern" "North African") recast(scatter) ytitle("Pr(ID as White only)") scheme(cleanplots) ///
 xtitle("") title("") ylabel(0(.1)1)
 graph export notwhiteonly_ancestry.pdf, as(pdf) replace
 

**Figure S21
reg nct_white i.nct_treat##i.generation if profile==1&source<3
margins nct_treat, over(generation)
marginsplot, recast(scatter) ytitle("Pr(ID as White only)") scheme(cleanplots) ///
 xtitle("") title("") ylabel(0(.1)1)
 graph export notwhiteonly_bygen.pdf, as(pdf) replace
 

**Figure S22
 lab def alotdisc_lbl 0"Not a lot" 1"A lot"
 lab val alotmenadisc alotdisc_lbl
 reg nct_white i.nct_treat##i.alotmenadisc if profile==1&source<3
margins nct_treat, over(alotmenadisc)
marginsplot, recast(scatter) ytitle("Pr(ID as White only)") scheme(cleanplots) ///
 xtitle("") title("") ylabel(0(.1)1)
 graph export notwhiteonly_bydiscrim.pdf, as(pdf) replace
 

**Figure S23
hist nct_resp_detail if profile==1&relig_cat==1, by(nct_treat, note("") legend(off)) discrete percent scheme(cleanplots) addlabels addlabopts(mlabsize(vsmall))  ///
ylabel(0(10)100) xlabel(1(1)15, valuelabel labsize(vsmall) angle(45)) xtitle("") gap(60)
graph export muslim_combined_nct_detail.pdf, as(pdf) replace

**Figure S24
hist nct_resp_detail if profile==1&relig_cat==2, by(nct_treat, note("") legend(off)) discrete percent scheme(cleanplots) addlabels addlabopts(mlabsize(vsmall))  ///
ylabel(0(10)100) xlabel(1(1)15, valuelabel labsize(vsmall) angle(45)) xtitle("") gap(60)
graph export christian_combined_nct_detail.pdf, as(pdf) replace

**Figure S25
hist nct_resp_detail if profile==1&relig_cat==3, by(nct_treat, note("") legend(off)) discrete percent scheme(cleanplots) addlabels addlabopts(mlabsize(vsmall))  ///
ylabel(0(10)100) xlabel(1(1)15, valuelabel labsize(vsmall) angle(45)) xtitle("") gap(60)
graph export otherrelig_combined_nct_detail.pdf, as(pdf) replace

**Figure S26
hist nct_resp_detail if profile==1&relig_cat==4, by(nct_treat, note("") legend(off)) discrete percent scheme(cleanplots) addlabels addlabopts(mlabsize(vsmall))  ///
ylabel(0(10)100) xlabel(1(1)15, valuelabel labsize(vsmall) angle(45)) xtitle("") gap(60)
graph export norelig_combined_nct_detail.pdf, as(pdf) replace

**Figure S27
 reg nct_white i.nct_treat##i.relig_cat if profile==1&source<3
margins nct_treat, over(relig_cat) post
coefplot, scheme(cleanplots) xtitle("Pr(ID as White only)")
graph export notwhiteonly_byrelig.pdf, as(pdf) replace

**Figure S28
lab val alotmuslimdisc alotdisc_lbl
 
 reg nct_white i.nct_treat##i.alotmenadisc if profile==1&source<3
margins nct_treat, over(alotmenadisc) 
marginsplot, recast(scatter) ytitle("Pr(ID as White only)") scheme(cleanplots) ///
 xtitle("") title("Anti-MENA Discrimination") ylabel(0(.1)1)
 graph save menadisc.gph, replace

 reg nct_white i.nct_treat##i.alotmuslimdisc if profile==1&source<3
margins nct_treat, over(alotmuslimdisc) 
marginsplot, recast(scatter) ytitle("Pr(ID as White only)") scheme(cleanplots) ///
 xtitle("") title("Anti-Muslim Discrimination") ylabel(0(.1)1)
 graph save muslimdisc.gph, replace
 
 graph combine menadisc.gph muslimdisc.gph, xcommon ycommon scheme(cleanplots)
 graph export comparingdiscrim.pdf, as(pdf) replace
